<template>
	<view>
		<view class="m20 bg-fff radius20  px20 pb42">
			<u-form :model="form" ref="uForm" label-width="auto" :label-style="{color: '#666'}">
				<u-form-item label="就诊人姓名">
					<u-input v-model="form.name" placeholder="请填写就诊人姓名" inputAlign="right" />
				</u-form-item>
				<u-form-item label="手机号码">
					<u-input v-model="form.mobile" maxlength="11" type="number" placeholder="请填写就诊人手机号"
						inputAlign="right" />
				</u-form-item>
				<u-form-item label="收件地址">
					<u-input v-model="form.address" placeholder="请填写收件地址" inputAlign="right" />
				</u-form-item>
			</u-form>
			<view class=" h84 radius12 bg-zs color-fff flex row-center mt60"
				@click="submit">
				{{form.id?'修改':'添加'}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					id: '', //	字符串	必填	-	-	地址id
					name: '', //	字符串	必填	-	-	姓名
					mobile: '', //	字符串	必填	-	-	手机号
					address: '', //	字符串	必填	-	-	收件地址
				},
			};
		},
		onLoad(e) {
			for (let key in this.form) {
				this.form[key] = e[key]
			}
			if (e.id) {
				uni.setNavigationBarTitle({
					title: '修改收件信息'
				})
			}
		},
		methods: {
			submit() {
				let api = '/member/my/addressAdd'
				if (this.form.id) api = '/member/my/addressEdit'
				this.$request(api, this.form).then(res => {
					this.$msg(res.msg)
					setTimeout(this.$navBack, 1000)
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
